package com.micro.frog.fortune.model.base;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author jason.lv
 * @since 2022/1/6 16:38
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "对象响应")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ObjectResp<T> extends Resp {

  @ApiModelProperty(value = "对象数据")
  @JsonProperty("data")
  private T data;

  public static <T> ObjectResp<T> generate(T item) {
    ObjectResp<T> response = new ObjectResp<>();
    response.setData(item);
    return response;
  }
}
